home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / mac / Chapter Tutorials / CaseStudies / ch10.macromedia / hotcon.dcr / 00004.ls < prev    next >
Encoding:
Text File  |  1996-11-10  |  9.1 KB  |  332 lines

  1. global gAddressList, cMList, cMSprite, cStageWidth, cSpinCast, cSpinSprite, cHoldRect
  2.  
  3. on startMovie
  4.   repeat with channel = 10 to 19
  5.     puppetSprite(channel, 1)
  6.   end repeat
  7.   set the randomSeed to the ticks
  8.   set gAddressList to ["http://www.macromedia.com/Brain", "http://www.macromedia.com/Industry", "http://www.macromedia.com/Tools", "http://www.macromedia.com/AYS", "http://www.macromedia.com/Gallery", "http://www.macromedia.com/Toys", "http://www.macromedia.com/Search", "http://www.macromedia.com/Industry/Macro"]
  9.   set cMList to ["MrStrechUp", "MrStrechDown", "MrWalkAround", "MrRotater"]
  10.   set cSpinSprite to 18
  11.   set cSpinCast to the castNum of sprite cSpinSprite
  12.   set cMSprite to 19
  13.   set cHoldRect to the rect of sprite cMSprite
  14.   set cStageWidth to the stageRight - the stageLeft
  15.   startTimer()
  16. end
  17.  
  18. on stopMovie
  19.   repeat with channel = 10 to 19
  20.     puppetSprite(channel, 0)
  21.   end repeat
  22. end
  23.  
  24. on goToNetPage destination
  25.   alert("Going to " & destination)
  26. end
  27.  
  28. on checkRoll
  29.   if the timer > 600 then
  30.     do("MrAutoRotate")
  31.   end if
  32.   if rollOver(10) then
  33.     set whichOne to getAt(cMList, random(count(cMList)))
  34.     do(whichOne)
  35.   end if
  36.   repeat with spriteCounter = 11 to 17
  37.     set holdLoc to the loc of sprite spriteCounter
  38.     repeat while rollOver(spriteCounter)
  39.       if the mouseDown then
  40.         set the loc of sprite spriteCounter to holdLoc
  41.         updateStage()
  42.         exit repeat
  43.       end if
  44.       set the loc of sprite spriteCounter to holdLoc + point(2, 0)
  45.       updateStage()
  46.       set the loc of sprite spriteCounter to holdLoc + point(2, 2)
  47.       updateStage()
  48.       set the loc of sprite spriteCounter to holdLoc + point(0, 2)
  49.       updateStage()
  50.       set the loc of sprite spriteCounter to holdLoc
  51.       updateStage()
  52.     end repeat
  53.     set the loc of sprite spriteCounter to holdLoc
  54.     updateStage()
  55.   end repeat
  56. end
  57.  
  58. on MrStrechUp
  59.   set cHoldRect to the rect of sprite cMSprite
  60.   set MLeft to getAt(cHoldRect, 1)
  61.   set MTop to getAt(cHoldRect, 2)
  62.   set MRight to getAt(cHoldRect, 3)
  63.   set MBottom to getAt(cHoldRect, 4)
  64.   set MDirection to #down
  65.   puppetSound("UpNdown")
  66.   repeat while rollOver(10)
  67.     if the mouseDown then
  68.       set MTop to getAt(cHoldRect, 2)
  69.       spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  70.       puppetSound(0)
  71.       updateStage()
  72.       exit repeat
  73.     end if
  74.     if MDirection = #down then
  75.       set MTop to MTop - 2
  76.       if MTop = 0 then
  77.         set MTop to MTop + 2
  78.         set MDirection to #up
  79.       end if
  80.     else
  81.       set MTop to MTop + 2
  82.       if MTop > getAt(cHoldRect, 2) then
  83.         set MTop to MTop - 2
  84.         set MDirection to #down
  85.       end if
  86.     end if
  87.     spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  88.     updateStage()
  89.   end repeat
  90.   set MTop to getAt(cHoldRect, 2)
  91.   spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  92.   puppetSound(0)
  93.   updateStage()
  94.   startTimer()
  95. end
  96.  
  97. on MrStrechDown
  98.   set cHoldRect to the rect of sprite cMSprite
  99.   set MLeft to getAt(cHoldRect, 1)
  100.   set MTop to getAt(cHoldRect, 2)
  101.   set MRight to getAt(cHoldRect, 3)
  102.   set MBottom to getAt(cHoldRect, 4)
  103.   set MDirection to #down
  104.   puppetSound("Springy")
  105.   repeat while rollOver(10)
  106.     if the mouseDown then
  107.       set MTop to getAt(cHoldRect, 2)
  108.       spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  109.       puppetSound(0)
  110.       updateStage()
  111.       exit repeat
  112.     end if
  113.     if MDirection = #down then
  114.       set MTop to MTop + 2
  115.       if MTop > MBottom then
  116.         set MTop to MTop - 2
  117.         set MDirection to #up
  118.       end if
  119.     else
  120.       set MTop to MTop - 2
  121.       if MTop < getAt(cHoldRect, 2) then
  122.         set MTop to MTop + 2
  123.         set MDirection to #down
  124.       end if
  125.     end if
  126.     spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  127.     updateStage()
  128.   end repeat
  129.   puppetSound(0)
  130.   set MTop to getAt(cHoldRect, 2)
  131.   spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  132.   updateStage()
  133.   startTimer()
  134. end
  135.  
  136. on MrWalkAround
  137.   set cHoldRect to the rect of sprite cMSprite
  138.   set holdWidth to the width of sprite cMSprite
  139.   set holdHeight to the height of sprite cMSprite
  140.   set stepDistance to 3
  141.   set the foreColor of sprite 10 to 255
  142.   set MLeft to getAt(cHoldRect, 1)
  143.   set MTop to getAt(cHoldRect, 2)
  144.   set MRight to getAt(cHoldRect, 3)
  145.   set MBottom to getAt(cHoldRect, 4)
  146.   repeat while rollOver(10)
  147.     repeat with ii = 2 to 9
  148.       puppetSound("Slide")
  149.       repeat while MRight <= (holdWidth * ii)
  150.         if not rollOver(10) then
  151.           resetScene()
  152.           exit repeat
  153.         end if
  154.         set MRight to MRight + stepDistance
  155.         spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  156.         updateStage()
  157.       end repeat
  158.       repeat while MLeft < (holdWidth * (ii - 1))
  159.         if not rollOver(10) then
  160.           resetScene()
  161.           exit repeat
  162.         end if
  163.         set MLeft to MLeft + stepDistance + 2
  164.         spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  165.         updateStage()
  166.       end repeat
  167.     end repeat
  168.     puppetSound("Slide")
  169.     repeat while MTop >= (getAt(cHoldRect, 3) - holdHeight)
  170.       if not rollOver(10) then
  171.         resetScene()
  172.         exit repeat
  173.       end if
  174.       set MTop to MTop - stepDistance
  175.       spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  176.       updateStage()
  177.     end repeat
  178.     repeat while MBottom >= (getAt(cHoldRect, 2) - 1)
  179.       if not rollOver(10) then
  180.         resetScene()
  181.         exit repeat
  182.       end if
  183.       set MBottom to MBottom - stepDistance - 2
  184.       spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  185.       updateStage()
  186.     end repeat
  187.     puppetSound("Click Clack")
  188.     repeat with ii = 8 down to 0
  189.       repeat while MLeft >= (holdWidth * ii)
  190.         if not rollOver(10) then
  191.           resetScene()
  192.           exit repeat
  193.         end if
  194.         set MLeft to MLeft - stepDistance
  195.         spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  196.         updateStage()
  197.       end repeat
  198.       repeat while MRight >= (holdWidth * ii)
  199.         if not rollOver(10) then
  200.           resetScene()
  201.           exit repeat
  202.         end if
  203.         set MRight to MRight - stepDistance
  204.         spriteBox(cMSprite, MLeft, MTop, MRight, MBottom)
  205.         updateStage()
  206.       end repeat
  207.     end repeat
  208.   end repeat
  209.   resetScene()
  210. end
  211.  
  212. on resetScene
  213.   puppetSound(0)
  214.   set the foreColor of sprite 10 to 35
  215.   spriteBox(cMSprite, getAt(cHoldRect, 1), getAt(cHoldRect, 2), getAt(cHoldRect, 3), getAt(cHoldRect, 4))
  216.   updateStage()
  217.   startTimer()
  218. end
  219.  
  220. on MrRotater
  221.   puppetSound("Pop")
  222.   set holdCast to the castNum of sprite cMSprite
  223.   set the castNum of sprite cMSprite to holdCast + 1
  224.   updateStage()
  225.   repeat while rollOver(10)
  226.     repeat with x = 0 to 3
  227.       set the castNum of sprite cMSprite to holdCast + x
  228.       repeat with y = 1 to 50
  229.         if not rollOver(10) then
  230.           set the castNum of sprite cMSprite to holdCast
  231.           puppetSound(0)
  232.           updateStage()
  233.           exit repeat
  234.         end if
  235.         if the mouseDown then
  236.           set the castNum of sprite cMSprite to holdCast
  237.           puppetSound(0)
  238.           updateStage()
  239.           exit repeat
  240.         end if
  241.       end repeat
  242.       updateStage()
  243.     end repeat
  244.   end repeat
  245.   puppetSound(0)
  246.   set the castNum of sprite cMSprite to holdCast
  247.   updateStage()
  248.   startTimer()
  249. end
  250.  
  251. on MrAutoRotate
  252.   set holdCast to the castNum of sprite cMSprite
  253.   set the castNum of sprite cMSprite to holdCast + 1
  254.   updateStage()
  255.   repeat with numOTimes = 1 to 3
  256.     repeat with x = 0 to 3
  257.       set the castNum of sprite cMSprite to holdCast + x
  258.       repeat with y = 1 to 50
  259.         if rollOver(10) then
  260.           set the castNum of sprite cMSprite to holdCast
  261.           updateStage()
  262.           exit repeat
  263.         end if
  264.         if the mouseDown then
  265.           set the castNum of sprite cMSprite to holdCast
  266.           updateStage()
  267.           exit repeat
  268.         end if
  269.       end repeat
  270.       updateStage()
  271.     end repeat
  272.   end repeat
  273.   set the castNum of sprite cMSprite to holdCast
  274.   updateStage()
  275.   startTimer()
  276. end
  277.  
  278. on spinIt
  279.   if the castNum of sprite cSpinSprite <> cSpinCast then
  280.     exit
  281.   else
  282.     startTimer()
  283.     puppetSound("drive up")
  284.     set delayRepeats to 48
  285.     repeat with i = 1 to 4
  286.       set delayRepeats to delayRepeats / 2
  287.       repeat with x = 1 to 3
  288.         set the castNum of sprite cSpinSprite to cSpinCast + x
  289.         updateStage()
  290.         repeat with yy = 1 to delayRepeats
  291.         end repeat
  292.       end repeat
  293.     end repeat
  294.     puppetSound("drive play")
  295.     set delayRepeats to 12
  296.     repeat while the mouseDown
  297.       repeat with x = 1 to 3
  298.         set the castNum of sprite cSpinSprite to cSpinCast + x
  299.         updateStage()
  300.         repeat with y = 1 to delayRepeats
  301.         end repeat
  302.       end repeat
  303.     end repeat
  304.   end if
  305. end
  306.  
  307. on slowItAndStopIt
  308.   puppetSound("disk down")
  309.   set delayRepeats to 2
  310.   repeat with i = 1 to 4
  311.     set delayRepeats to delayRepeats * 2
  312.     repeat with x = 1 to 3
  313.       set the castNum of sprite cSpinSprite to cSpinCast + x
  314.       updateStage()
  315.       repeat with yy = 1 to delayRepeats
  316.       end repeat
  317.     end repeat
  318.   end repeat
  319.   repeat while soundBusy(1)
  320.     repeat with x = 1 to 3
  321.       set the castNum of sprite cSpinSprite to cSpinCast + x
  322.       updateStage()
  323.       repeat with yy = 1 to delayRepeats
  324.       end repeat
  325.     end repeat
  326.   end repeat
  327.   puppetSound(0)
  328.   set the castNum of sprite cSpinSprite to cSpinCast
  329.   updateStage()
  330.   startTimer()
  331. end
  332.